home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
program
/
fpk65_66.zip
/
SOURCE
/
RTL
/
DOS
/
PIXEL.PPI
< prev
next >
Wrap
Text File
|
1997-01-07
|
5KB
|
152 lines
{ File PIXEL.PPI }
procedure putpixel(x,y:integer;colour:longint);
var viewport:viewporttype;
begin
if aktviewport.clip then viewport:=aktviewport else viewport:=aktscreen;
asm
xorl %eax,%eax
movl %eax,%ebx
movw x,%bx
movw y,%ax
addw _AKTVIEWPORT,%bx
addw _AKTVIEWPORT+2,%ax
cmpw viewport,%bx
jl p_exit // wenn x < x1 Ende
cmpw -8(%ebp),%bx
jg p_exit // wenn x > x2 Ende
cmpw -10(%ebp),%ax
jl p_exit // wenn y < y1 Ende
cmpw -6(%ebp),%ax
jg p_exit // wenn y > y2 Ende
movl _Y_ARRAY(,%eax,4),%eax
addl _X_ARRAY(,%ebx,4),%eax
movl %eax,%esi
movl _WINSHIFT,%ecx // { offset / winsize }
shrl %cl,%eax //
cmpl _AW_BANK,%eax // { same bank ? }
je p_dont_switch // { yep }
movl %eax,_AW_BANK // { newbank }
pushl %eax //
movl _BANKSWITCHPTR,%eax // { switchbank }
call %eax //
p_dont_switch:
andl _WINLOMASK,%esi
movl colour,%eax
addl _WBUFFER,%esi
movw _SEG_WRITE,%bx
movw _BYTESPERPIXEL,%cx
movw %ds,%dx
movw %bx,%ds
testl $1,%ecx
jz pp_2BPP
movb %al,(%esi)
jnz pp_exit
pp_2BPP:
movw %ax,(%esi)
pp_exit:
movw %dx,%ds
p_exit:
end;
end; { proc }
procedure pixel(offset:longint);
{ wird nur intern aufgerufen, umrechnung auf Viewport und Range- }
{ checking muessen von aufrufender Routine bereits erledigt sein }
{ Bankswitching wird durchgefuehrt }
begin
asm
movl offset,%eax
movl %eax,%esi
movl _WINSHIFT,%ecx // { offset / winsize }
shrl %cl,%eax //
cmpl _AW_BANK,%eax // { same bank ? }
je dont_switch // { yep }
movl %eax,_AW_BANK // { newbank }
pushl %eax //
movl _BANKSWITCHPTR,%eax // { switchbank }
call %eax //
dont_switch:
movl _WINLOMASK,%eax
andl %eax,%esi
movl _AKTCOLOR,%eax
movzwl _AKTWRITEMODE,%ecx
movw _BYTESPERPIXEL,%bx
addl _WBUFFER,%esi
movw _SEG_WRITE,%dx
movw %ds,%di
movw %dx,%ds
testl %ecx,%ecx
jz dmove
shrl %ebx
jnc dxor2BPP
xorb %al,(%esi)
jnc pd_exit
dxor2BPP:
xorw %ax,(%esi)
jnc pd_exit
dmove:
shrl %ebx
jnc dmove2BPP
movb %al,(%esi)
jc pd_exit
dmove2BPP:
movw %ax,(%esi)
pd_exit:
movw %di,%ds
end;
end; { proc }
function getpixel(x,y:integer):longint;
var viewport:viewporttype;
begin
if aktviewport.clip then viewport:=aktviewport else viewport:=aktscreen;
asm
movswl x,%ebx
movswl y,%eax
addw _AKTVIEWPORT,%bx
addw _AKTVIEWPORT+2,%ax
cmpw viewport,%bx
jl gp_exit // wenn x < x1 Ende
cmpw -8(%ebp),%bx
jg gp_exit // wenn x > x2 Ende
cmpw -10(%ebp),%ax
jl gp_exit // wenn y < y1 Ende
cmpw -6(%ebp),%ax
jg gp_exit // wenn y > y2 Ende
movl _Y_ARRAY(,%eax,4),%eax
addl _X_ARRAY(,%ebx,4),%eax
movl %eax,%esi
movl _WINSHIFT,%ecx // { offset / winsize }
shrl %cl,%eax //
cmpl _AW_BANK,%eax // { same bank ? }
je g_dont_switch // { yep }
pushl %esi // { save Offset }
movl %eax,_AW_BANK // { newbank }
pushl %eax //
movl _BANKSWITCHPTR,%eax // { switchbank }
call %eax //
popl %esi // { restore Offset }
g_dont_switch:
movl _WINLOMASK,%eax
andl %eax,%esi
xorl %eax,%eax
movl _BYTESPERPIXEL,%edx
addl _WBUFFER,%esi
movw _SEG_WRITE,%bx
movw %ds,%cx
movw %bx,%ds
testl $1,%edx // { 1 or 2 BytesPerPixel ? }
jnz g_8BPP
movw %ds:(%esi),%ax
jnz g_Result
g_8BPP:
movb %ds:(%esi),%al
g_Result:
movw %cx,%ds
movl %eax,__RESULT
gp_exit:
end;
end; { proc }